using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ACME.Northwind.DataTransfer;
using ACME.Northwind.Service.Interfaces;

namespace ACME.Northwind.DALProxy
{
	/// <summary>
	/// Used to create and return an implementation of a DTO
	/// </summary>
	/// <typeparam name="T">The requested DTO</typeparam>
	public partial class ProxyFactory<T> : IProxyFactory<T> where T : IDTO
	{
		#region IProxyFactory<T> Members

		/// <summary>
		/// Gets a DTO implementation
		/// </summary>
		public IService<T> GetReadOnlyProxy()
		{
			if (false) {}
			else
				return null;
		}

		/// <summary>
		/// Gets a DTO implementation
		/// </summary>
		public IPersistableService<T> GetProxy()
		{
			if (false) {}
			else if (typeof(T) == typeof(CategoryDTO))
			{
				return (IPersistableService<T>) new CategoryService();
			}
			else if (typeof(T) == typeof(CustomerCustomerDemoDTO))
			{
				return (IPersistableService<T>) new CustomerCustomerDemoService();
			}
			else if (typeof(T) == typeof(CustomerDemographicDTO))
			{
				return (IPersistableService<T>) new CustomerDemographicService();
			}
			else if (typeof(T) == typeof(CustomerDTO))
			{
				return (IPersistableService<T>) new CustomerService();
			}
			else if (typeof(T) == typeof(EmployeeDTO))
			{
				return (IPersistableService<T>) new EmployeeService();
			}
			else if (typeof(T) == typeof(EmployeeTerritoryDTO))
			{
				return (IPersistableService<T>) new EmployeeTerritoryService();
			}
			else if (typeof(T) == typeof(OrderDetailDTO))
			{
				return (IPersistableService<T>) new OrderDetailService();
			}
			else if (typeof(T) == typeof(OrderDTO))
			{
				return (IPersistableService<T>) new OrderService();
			}
			else if (typeof(T) == typeof(ProductDTO))
			{
				return (IPersistableService<T>) new ProductService();
			}
			else if (typeof(T) == typeof(RegionDTO))
			{
				return (IPersistableService<T>) new RegionService();
			}
			else if (typeof(T) == typeof(ShipperDTO))
			{
				return (IPersistableService<T>) new ShipperService();
			}
			else if (typeof(T) == typeof(SupplierDTO))
			{
				return (IPersistableService<T>) new SupplierService();
			}
			else if (typeof(T) == typeof(TerritoryDTO))
			{
				return (IPersistableService<T>) new TerritoryService();
			}
			else
				return null;
		}

		#endregion
	}
}
